var babyObject=function () {
	
	this.x;
	this.y;
	this.angle;
//	this.babyEye=new Image();
//	this.babyBody=new Image();
//	this.babyTail=new Image();
	
	this.babyTailTime=0;
	this.babyTailCount=0;
	
	this.babyEyeTime=0;
	this.babyEyeCount=0;
	this.babyEyeInterval=1000;
	
	this.babyBodyTime=0;
	this.babyBodyCount=0;
}
babyObject.prototype.init=function () {
	
	this.x=canWidth*0.5-50;
	this.y=canHeight*0.5+50;
	this.angle=0;
//	this.babyEye.src="img/babyEye0.png";
//	this.babyBody.src="img/babyFade0.png";
//	this.babyTail.src="img/babyTail0.png";
}

babyObject.prototype.draw=function () {
	
	this.x=lerpDistance(mom.x,this.x,0.99);
	this.y=lerpDistance(mom.y,this.y,0.99);
	
	var deltaY=this.y-mom.y;
	var deltaX=this.x-mom.x;
	var beta=Math.atan2(deltaY,deltaX);//这个的返回值在-PI到PI之间
	
	this.angle=lerpAngle(beta,this.angle,0.6);
	
	//小鱼尾巴计数
	this.babyTailTime+=deltaTime;
	if(this.babyTailTime>50){
		this.babyTailCount=(this.babyTailCount+1)%8;
		this.babyTailTime %= 50;
	}
	//小鱼眼睛计数
	this.babyEyeTime+=deltaTime;
	if(this.babyEyeTime>this.babyEyeInterval){
		this.babyEyeCount=(this.babyEyeCount+1)%2;
		this.babyEyeTime %= this.babyEyeInterval;
		
		if(this.babyEyeCount==0){
			this.babyEyeInterval=Math.random()*1500+2000;
			
		}else{
			this.babyEyeInterval=200;		
		}
		
	}
	//小鱼身体变化
	this.babyBodyTime+=deltaTime;
	if(this.babyBodyTime>300){
		this.babyBodyCount=this.babyBodyCount+1;
		this.babyBodyTime %= 300;
		if(this.babyBodyCount>19){
			this.babyBodyCount=19;
			//游戏结束
			data.gameOver=true;
		}
	}
	
	context1.save();
	context1.translate(this.x,this.y);
	context1.rotate(this.angle);
	
	var babyTailCount=this.babyTailCount;
	context1.drawImage(babyTails[babyTailCount],-babyTails[babyTailCount].width*0.5+23,-babyTails[babyTailCount].height*0.5);
	
	var babyBodyCount=this.babyBodyCount;
	context1.drawImage(babyBodys[babyBodyCount],-babyBodys[babyBodyCount].width*0.5,-babyBodys[babyBodyCount].height*0.5);
	
	var babyEyeCount=this.babyEyeCount;
	context1.drawImage(babyEyes[babyEyeCount],-babyEyes[babyEyeCount].width*0.5,-babyEyes[babyEyeCount].height*0.5);
	context1.restore();
}